from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline

model_name = "WeisongZhao/bert-base-chinese-ner-relation-extraction"
model_path = "model"
tokenizer = AutoTokenizer.from_pretrained(model_name, cache_dir=model_path)
model = AutoModelForTokenClassification.from_pretrained(model_name, cache_dir=model_path)

nlp = pipeline("ner", model=model, tokenizer=tokenizer)

text = "马云在1999年创立了阿里巴巴。"
entities = nlp(text)

print(entities)
